//
//  WJLiveCourseItemModel.m
//  LEEAlertDemo
//
//  Created by 李响 on 2017/6/4.
//  Copyright © 2017年 lee. All rights reserved.
//

#import "WJLiveCourseItemModel.h"
#import "WJCalculateRMBTools.h"
#import <UIKit/UIKit.h>
@implementation WJLiveCourseItemModel


- (instancetype)init{
    if (self = [super init]) {
    
    }
    return self;
}


+ (NSDictionary *)mj_replacedKeyFromPropertyName
{
    return @{
             @"ID":@"id",
             @"title":@"name"
             };
}
- (void)setValue:(id)value forUndefinedKey:(NSString *)key{}


+(NSString *)sumPrice:(NSArray <WJLiveCourseItemModel*>*)priceArr{
    NSMutableArray * marray = [[NSMutableArray alloc]init];
    [priceArr enumerateObjectsUsingBlock:^(WJLiveCourseItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        // NSLog(@"选中的选项有%@",obj.price);
        [marray addObject:obj.price];
    }];
    CGFloat sum = [[marray valueForKeyPath:@"@sum.floatValue"] floatValue];
    NSString *priceString = [WJCalculateRMBTools notRounding:sum afterPoint:2];
    return priceString;
   
}

+(NSString *)idAppendId:(NSArray <WJLiveCourseItemModel*>*)ids withSeparator:(NSString *)separator{
    NSMutableArray * marray = [[NSMutableArray alloc]init];
    [ids enumerateObjectsUsingBlock:^(WJLiveCourseItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        [marray addObject:@(obj.ID)];
    }];
    NSString * idsString = [marray componentsJoinedByString:separator];
    return idsString;
}


@end
